import { request } from '@/utils/request.util';
import type { Response ,Res} from '@/types/common';
import type { DispenseList, DispenseDetail } from '~/types/pharmacy';
import type { DispenseHistory } from '~/types/dispenseHistory';

// 药房配药：获取配药单列表
export const getDispenseList = (body: {
  patientName: string; // 患者姓名
  visitDate: string; // 就诊日期
  pageNo: number; // 页码
  pageSize: number; // 每页条数
}) =>
  request.get<Response<DispenseList[]>>('/order/dispense/getDispenseList', {
    params: body,
  });

export const getDeliveryList = (body: {
  patientName: string; // 患者姓名
  visitDate: string; // 就诊日期
  pageNo: number; // 页码
  pageSize: number; // 每页条数
}) =>
  request.get<Response<DispenseList[]>>('/order/dispense/getDeliveryList', {
    params: body,
  });



// 药房配药：查询配药单详情
export const getDispenseDetail = (body: {
  orderId: number; // 配药单ID
}) =>
  request.get<Response<DispenseDetail>>('/order/dispense/getDispenseDetail', {
    params: body,
  });

//发药详情
export const getDeliveryDetail = (body: {
  orderId: number; // 配药单ID
}) =>
  request.get<Response<DispenseDetail>>('/order/dispense/getDeliveryDetail', {
    params: body,
  });





// 药房配药：获取患者配药历史
export const getDispenseHistoryList = (body: {
  patientId: number; // 患者ID
  pageNo: number; // 页码
  pageSize: number; // 每页条数
}) =>
  request.get<Response<DispenseHistory[]>>('/order/dispense/getDispenseHistoryList', {
    params: body,
  });

//发药lishi
export const getDeliveryHistoryList = (body: {
  patientId: number; // 患者ID
  pageNo: number; // 页码
  pageSize: number; // 每页条数
}) =>
  request.get<Response<DispenseHistory[]>>('/order/dispense/getDeliveryHistoryList', {
    params: body,
  });


//完成配药
export const completeDispense = (body:any) => request.post<Response<Res>>("/order/dispense/completeDispense",body);
